#include<stdio.h>
#include<stdlib.h>
#include<at89c51ed2.h>
#include <mcs51reg.h>


void putchar (char c)__critical
{
	while ((SCON & 0x02) == 0);    // wait for TX ready, spin on TI
	SBUF = c;  	// load serial port with transmit value
	TI = 0;  	// clear TI flag
}



void putstr (char *s)  //had return type int in sample file
{
	int i = 0;
	while (*s){			// output characters until NULL found
		putchar(*s++);
		i++;
	}
	putchar('\n');
	}
	
	
char getchar ()
{
	
    while (!RI);             
   	RI = 0;			// clear RI flag
	return SBUF;  	// return character from SBUF
}
